/**
 * Created by qiangqiang on 2016/12/11.
 */
import React, {Component} from 'react';
import {
    Text,
    Image,
    View,
    StyleSheet
} from 'react-native';

/*第三方组件  react-native-star-rating
 安装方法：
 npm install react-native-star-rating --save
 作者网站：
 https://github.com/djchie/react-native-star-rating
 Props
 Prop	Type	Description	                                                                              Required	Default
 disabled	bool	Sets the interactivity of the star buttons.	                                                No	false
 emptyStar	string	The name of the icon to represent an empty star. Refer to react-native-vector-icons.	    No	star-o
 fullStar	string	The name of the icon to represent a full star. Refer to react-native-vector-icons.	        No	star
 halfStar	string	The name of the icon to represent an half star. Refer to react-native-vector-icons.	        No	star-half-o
 iconSet	string	The name of the icon set the star image belongs to. Refer to react-native-vector-icons.	    No	FontAwesome
 maxStars	number	The maximum number of stars possible.	                                                    No	5
 rating	number	The current rating to show.	                                                                    No	0
 selectedStar	function	A function to handle star button presses.	                                        Yes	None
 starColor	string	Color of a filled star.	                                                                    No	black
 emptyStarColor	string	Color of an empty star.	                                                                No	gray
 starSize	number	Size of the star.	                                                                        No	40
 */

import Starrating from 'react-native-star-rating';

export default class Star extends Component {
    constructor(props) {
        super(props);
        this.state = {
            starCount: 3.5
        };
    }

    onStarRatingPress(rating) {
        this.setState({
            starCount: rating
        });
    }

    render() {
        return (
            <Starrating
                disabled={false}
                maxStars={5}
                fullStar={}
                emptyStar={}
                starColor={"#FFFF00"}
                rating={this.state.starCount}
                selectedStar={(rating) => this.onStarRatingPress(rating)}
            />
        );
    }
}
